package com.sp.scmdb.action;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.sp.scmdb.bean.DaySecurityBean;
import com.sp.scmdb.common.action.BaseAction;
import com.sp.scmdb.service.DaySecurityService;

@Controller("daySecurityAction")
@Scope("prototype")
public class DaySecurityAction extends BaseAction<DaySecurityBean> {

	private static final long serialVersionUID = 938489298384920L;
	private static Log log = LogFactory.getLog(DaySecurityAction.class);
	private DaySecurityService daySecurityService;
	
	@Autowired
	public void setDaySecurityService(DaySecurityService daySecurityService) {
		this.daySecurityService = daySecurityService;
	}
	
	public String findAll() {
		try {
			List<DaySecurityBean> daySecurityList = daySecurityService.getListDaySecurity(null);
			entity.setAllList(daySecurityList);
			entity.setList(daySecurityList.subList(entity.getCurrentRow(), entity.getLastRow()));
			
		} catch (Exception e) {
			log.error("findAll fail!reason:" + e.getMessage());
			return "fail";
		}
		return SUCCESS;
	}

}
